package edu.towson.cis.cosc442.project2.vendingmachine;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The unit test Class for VendingMachineItem.
 */
public class VendingMachineItemTest {

	VendingMachineItem itemtest, itemtest1;

	//Defines testing principles

    @Before
    public void define() throws Exception {
            itemtest = new VendingMachineItem("Kit Kat", 1.0);
            itemtest1 = new VendingMachineItem("Reese's", 10.0);
            
    }
    //tests that the name will not be added with a negative price
    @Test(expected = VendingMachineException.class)
    public void testPriceLessThanZeroException() throws VendingMachineException {
        itemtest = new VendingMachineItem("KitKat",-99.00);
    }
   
    //tests to make sure the name matches the getName
    @Test
    public void getNameTestnPrice(){
    	assertEquals("Kit Kat", itemtest.getName() );
    	
   
    }
    //Tests to make sure the getPrice methods gets is equal to the actual price
    @Test
    public void getPricePrice(){
    	assertTrue(1.0 == itemtest.getPrice());
    }
    //gets rid of the excess
    @After
    public void tearDown() {
            itemtest = null;
            itemtest1 = null;
    }
        
        
}